#parse('/subject/edit/menu_include.html')
<h3>课题基本信息</h3>
<form id="subject-update-form">
    <input type="hidden" name="id" value="$!subject.id">
    <table>
        <tr>
            <td>课题名称：</td>
            <td><input type="text" autocomplete="off" name="name" value="$!subject.name"></td>
        </tr>
        <tr>
            <td>申报课题类别：</td>
            <td>
                <input type="hidden" name="category" value="$!subject.category.value">
                <select onchange="$(this).siblings('input').val($(this).val());">
                    #foreach($category in $categorys)
                    <option value="$!category.value"#if($category.value == $subject.category.value) selected = "selected"#end>$!category.desc</option>
                    #end
                </select>
            </td>
        </tr>
        <tr>
            <td>学科分类：</td>
            <td>
                <input type="hidden" name="classification" value="$!subject.classification.value">
                <select onchange="$(this).siblings('input').val($(this).val());">
                    #foreach($classification in $classifications)
                    <option value="$!classification.value"#if($classification.value == $subject.classification.value) selected = "selected"#end>$!classification.desc</option>
                    #end
                </select>
            </td>
        </tr>
        <tr>
            <td>负责人姓名：</td>
            <td>$!subject.user.realname</td>
        </tr>
        <tr>
            <td>性别：</td>
            <td>$!subject.user.gender.desc</td>
        </tr>
        <tr>
            <td>民族：</td>
            <td>$!subject.user.ethnic</td>
        </tr>
        <tr>
            <td>出生年月：</td>
            <td>$!dateTool.format('yyyy年MM月dd日',$!subject.user.birthday)</td>
        </tr>
        <tr>
            <td>行政职务：</td>
            <td>$!subject.user.position</td>
        </tr>
        <tr>
            <td>专业技术职务：</td>
            <td>$!subject.user.professionalTitle</td>
        </tr>
        <tr>
            <td>学科专长：</td>
            <td>$!subject.user.profession</td>
        </tr>
        <tr>
            <td>最后学历：</td>
            <td>$!subject.user.education</td>
        </tr>
        <tr>
            <td>最后学位：</td>
            <td>$!subject.user.degree</td>
        </tr>
        <tr>
            <td>手机号码：</td>
            <td>$!subject.user.phone</td>
        </tr>
        <tr>
            <td>工作单位：</td>
            <td>$!subject.user.unit.name</td>
        </tr>
        <tr>
            <td>办公电话：</td>
            <td>$!subject.user.telephone</td>
        </tr>
        <tr>
            <td>单位传真：</td>
            <td>$!subject.user.fax</td>
        </tr>
        <tr>
            <td>通讯地址：</td>
            <td>$!subject.user.address</td>
        </tr>
        <tr>
            <td>邮编：</td>
            <td>$!subject.user.postcode</td>
        </tr>
        <tr>
            <td>电子邮件：</td>
            <td>$!subject.user.email</td>
        </tr>
    </table>
    <h3>课题基本信息</h3>
    <table>
        <tr>
            <td>预期最终成果：</td>
            <td><input type="text" autocomplete="off" name="finalresult" value="$!subject.finalresult"></td>
        </tr>
        <tr>
            <td>申请资助经费(元)：</td>
            <td><input type="text" autocomplete="off" name="grants" value="$!subject.grants"></td>
        </tr>
        <tr>
            <td>预计完成时间：</td>
            <td><input type="date" autocomplete="off" name="complete_time" value="$!dateTool.format('yyyy-MM-dd',$!subject.completeTime)"></td>
        </tr>
        <tr>
            <td>经费类别：</td>
            <td>
                <input type="hidden" name="financialcategory" value="$!subject.financialcategory.value">
                <select onchange="$(this).siblings('input').val($(this).val());">
                    #foreach($financialcategory in $financialcategorys)
                    <option value="$!financialcategory.value"#if($financialcategory.value == $subject.financialcategory.value) selected = "selected"#end>$!financialcategory.desc</option>
                    #end
                </select>
            </td>
        </tr>
        <tr>
            <td>开户银行及单位国库支付中心账号(B类免填)：</td>
            <td><input type="text" autocomplete="off" name="bankcard" value="$!subject.bankcard"></td>
        </tr>
    </table>
</form>
<input type="button" value="返回" data-url="/subject/host" onclick="openPage(this)">
<input type="button" value="下一步" onclick="subjectUpdate('/subject/$!subjectId/edit/personnel')">
<script type="text/javascript">

    function subjectUpdate(skipUrl) {
        $.ajax({
            url: "/api/subject/update",
            type: "post",
            data: new FormData($("#subject-update-form")[0]),
            dataType: "json",
            cache: false, // 上传文件无需缓存
            processData: false, // 用于对data参数进行序列化处理 这里必须false
            contentType: false, // 必须
            beforeSend: function() {
            },
            complete: function() {
            },
            success: function (result) {
                if (result.code == 200) {
                    if (skipUrl) {
                        openUrl(skipUrl);
                    } else {
                        alert(result.msg);
                    }
                } else {
                    alert(result.msg);
                }
            },error: function (result) {
                alert("网络连接出错！");
            }
        });
    }
</script>
